package com.zizy.healthexpert.Adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.zizy.healthexpert.Database.MyDatabase_SportsRecords;
import com.zizy.healthexpert.R;

import org.w3c.dom.Text;

import java.util.List;

/**
 * Created by Zizy on 2014/9/20.
 */
//TODO
public class listSportsAdapter extends ArrayAdapter {
    private Context context = null;
    private int res = 0;

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewGroup viewGroup=(ViewGroup)View.inflate(context,res,null);
        MyDatabase_SportsRecords.FieldsSportsRecords item =(MyDatabase_SportsRecords.FieldsSportsRecords) getItem(position);
        String date = item.getDate();
        String sportsName = item.getSportsName();
        int sportsTime = item.getSportsTime();
        TextView txtSportDate = (TextView) viewGroup.findViewById(R.id.txtSportsDate);
        TextView txtSportDetail = (TextView) viewGroup.findViewById(R.id.txtSportsDetail);
        txtSportDate.setText(date);
        txtSportDetail.setText(sportsName+" : "+sportsTime+"分钟");
        return viewGroup;
    }

    public listSportsAdapter(Context context, int resource, List objects) {
        super(context, resource, objects);
        this.context = context;
        this.res=resource;
    }
    static  public class listSport{


    }
}
